package com.vmove.childtrain.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.vmove.childtrain.R;


/**
 * programAddActivity中的步骤编辑view 封装
 */
public class TrainResultView extends LinearLayout {


    private Context mContext;
    private TextView mTvTrainGroup;
    private TextView mTvTrainTime;
    private TextView mTvTrainSucc;
    private TextView mTvTrainFail;

    public TrainResultView(Context context) {
        super(context);
        init(context);
    }

    public TrainResultView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    private void init(Context context) {
        this.mContext = context;
        View inflate = LayoutInflater.from(context).inflate(R.layout.view_train_result, this);
        mTvTrainGroup = inflate.findViewById(R.id.tv_result_group);
        mTvTrainTime = inflate.findViewById(R.id.tv_result_time);
        mTvTrainSucc= inflate.findViewById(R.id.tv_result_succ);
        mTvTrainFail = inflate.findViewById(R.id.tv_result_fail);
    }

    public void setGroupName(String name){
        mTvTrainGroup.setText("分组："+name);
    }

    public void setTrainTime(int time){
        float t = time/1000f;
        mTvTrainTime.setText("反应用时"+t+"秒");
    }

    public void setTrainScccCount(int count){
        mTvTrainSucc.setText("成功"+count+"次");
    }

    public void setTrainFailCount(int count){
        mTvTrainFail.setText("失败"+count+"次");
    }

}
